package com.gzz.orchid.context.domain.rbac.entity;

import com.gzz.orchid.context.infrastructure.definition.Status;
import com.gzz.orchid.context.infrastructure.persistence.entity.sys.SysRolePo;
import lombok.Data;

/**
 * @author higmd
 */
@Data
public class RoleDo {
    private Long id;
    /**
     * 角色编码 code
     */
    private String code;
    /**
     * 角色名称 name
     */
    private String name;
    /**
     * 角色状态 status
     */
    private Status status;

    /**
     * 转换
     */
    public static RoleDo convertFrom(SysRolePo po) {
        RoleDo rdo = new RoleDo();
        rdo.setId(po.getId());
        rdo.setCode(po.getCode());
        rdo.setName(po.getName());
        rdo.setStatus(Status.parse(po.getStatus()));
        return rdo;
    }
}
